Repository navigation
Add an Edit link and a placeholder edit page - #107
mihailefter wants to merge 1 commit into
Conversation
dennisvang
left a comment
There was a problem hiding this comment.
Thanks @mihailefter, this looks good! 🙂
Only a few minor questions/suggestions in the comments.
| const { isLoggedIn } = useAuth() | ||
| const { isLoggedIn, isAdmin } = useAuth() | ||
| const membershipName = ref<string | null>(null) | ||
| const hasWrite = ref(false) |
There was a problem hiding this comment.
| const hasWrite = ref(false) | |
| const hasWritePermission = ref(false) |
and so on
| /> | ||
| </div> | ||
| <div v-if="deleteAvailable" class="resource-actions"> | ||
| <div v-if="canEdit || deleteAvailable" class="resource-actions"> |
There was a problem hiding this comment.
Could we use consistent names here, as in canEdit and canDelete, or is there a specific reason for using deleteAvailable?
| 'fetch', | ||
| mockApiFetch(okJson(), { | ||
| openapi: '3.0.1', | ||
| paths: { '/': { put: { operationId: 'putResearch Hub' } } }, |
There was a problem hiding this comment.
'putResearch Hub' makes me wonder what that is about and if it has any meaning in the application code. Could we use a more generic mock operationId value like 'mockOperation' or something like that?
Or perhaps use a variable, also because it is used twice:
const mockOperationId = 'some operation id'|
|
||
| it('allows members with W when the PUT is advertised', async () => { | ||
| offered.add('putcatalog') | ||
| const { canEdit, loaded } = await editAccess(metaWith('Owner', ['C', 'W', 'D', 'A'])) |
There was a problem hiding this comment.
perhaps we could introduce Enums for the membership name and permission codes (not just here, but in the app code)?
For example:
enum MembershipName {
Owner = 'Owner',
DataProvider = 'Data Provider',
}
enum PermissionCode {
Administration = 'A',
Create = 'C',
Delete = 'D',
Insert = 'I',
Read = 'R',
Write = 'W',
}
Add an Edit link next to the resource title, shown to users with
Wpermission on that resource and to admins, when the API docs advertise its PUT operation. It opens a placeholder edit page with breadcrumbs, the title and Cancel. The page says “Editing is not implemented yet”; the form follows in subsequent PRs.Opening an edit URL without write access redirects to the resource, as in the old client. Logged-out users are redirected to login. If the access check fails, the page displays the error rather than treating it as a permission denial.
The same access rules apply to the root: admins and members with
Wcan open its edit page when its PUT operation is advertised.Assisted-by: LLM claude